package com.base.util.javautils.log;


import com.orhanobut.logger.Logger;

/**
 * Created by gj on 15-11-22.
 * 对日志类的封装
 * 基于Logger git: https://github.com/orhanobut/logger
 *
 * @author gj
 * @see Logger
 */
public class LogUtil {

    public static ILogPrinter createLogPrinter(String tag) {
        return new LogPrinter(tag);
    }

    public static ILogPrinter createLogPrinter(Class cls) {
        return createLogPrinter(cls.getName());
    }

    private static final String TAG = "Debug";

    private static final ILogPrinter printer = new LogPrinter(TAG);

    public static void d(String message, Object... args) {
        printer.d(message, args);
    }

    public static void e(String message, Object... args) {
        printer.e(message, args);
    }

    public static void e(Throwable throwable, String message, Object... args) {
        printer.e(throwable, message, args);
    }

    public static void i(String message, Object... args) {
        printer.i(message, args);
    }

    public static void v(String message, Object... args) {
        printer.v(message, args);
    }

    public static void w(String message, Object... args) {
        printer.w(message, args);
    }

    public static void wtf(String message, Object... args) {
        printer.wtf(message, args);
    }

    /**
     * Formats the json content and print it
     *
     * @param json the json content
     */
    public static void json(String json) {
        printer.json(json);
    }

    /**
     * Formats the json content and print it
     *
     * @param xml the xml content
     */
    public static void xml(String xml) {
        printer.xml(xml);
    }
}
